# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Fangrui Song <i at maskray.me>

pkgname=ccls
pkgver=0.20230717
pkgrel=1
pkgdesc='C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting'
arch=('loong64' 'x86_64')
url='https://github.com/MaskRay/ccls'
license=('Apache')
depends=('clang' 'llvm-libs' 'rapidjson')
makedepends=('cmake' 'ninja' 'llvm')
conflicts=('ccls-git')
source=("https://github.com/MaskRay/$pkgname/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('f0fe31877151b76cabc17aa2ef8d3d87038805fbe43ca807e2e0824e90d952b1f5767f151788480aedf58e2ff569b72978fceeaca6b741b00c643d73f6afb445')

build() {
  cd $pkgname-$pkgver
  cmake . -GNinja -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_COMPILER=clang++ -DCLANG_LINK_CLANG_DYLIB=1
  cmake --build build
}

package() {
  cd $pkgname-$pkgver/build
  DESTDIR="$pkgdir" ninja install
}
